<template>
	<view class="">
		<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="loadMore" style="height: 98vh;">
			<view class="jui_bg_f5f  box ">
				<view class="jui_pad_b20 jui_bg_fff jui_pad_2432 jui_bor_bottom" @tap="detail(item)" v-for="(item,index) in list" :key="index">
					<view class="flex justify-between">
						<view class="jui_ellipsis_1" style="width: 70%;">
							{{item.n_title}}
						</view>
						<view class="flex jui_flex_items_center">
							<text class="jui_mar_r16">查看详情</text>
							<image src="/static/imgs/home/right.png" style="height: 24rpx;width: 12rpx;" mode="">
							</image>
						</view>
					</view>

					<view class="jui_fc_999 jui_fs29 jui_mar_t20 jui_mar_b8">
						{{item.n_time}}
					</view>

				</view>

				<!-- <shopro-empty v-if="!list.length" :emptyData="emptyData"></shopro-empty> -->
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				FromToken: '',
				list_rows: 20,
				page: 1,
				hasMore:false,
				list:[]
			}
		},
		onShow() {
			this.getFromToken()
		},
		methods: {
			getFromToken() {
				this.$api.getFromToken({
					data: 1
				}).then(res => {
					if (res.code == 1) {
						this.FromToken = res.FromToken;
						this.gonggao()
					}
				});
			},
			gonggao() {
				let data = {
					page: this.page,
					list_rows: this.list_rows
				}
				this.$api.getNoticeList(data).then(res => {
					if (res.code == 1) {
						this.list = res.data;
						if (this.page == 1) {
							this.list = res.data.data
						} else {
							this.list = [...this.list, ...res.data.data]
						}
						if (res.data.data.length == 0) {
							this.hasMore = false
						} else {
							this.hasMore = true
						}
					}
				});
			},
			detail(item) {
				uni.navigateTo({
					url: `/pages/index/news/newsDetail?id=${item.id}`
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #FFFFFF;
	}
</style>
